﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Netra
{
    class Planet:IPosition
    {

        private Position pos;
        public Position Pos { get { return pos; } }

        public Store store;
        public Store Store { get { return store; } }

        private HashSet<Fleet> docking;

        private readonly string name;
        public string Name { get { return name; } }

        public Planet(double x, double y,string _name)
        {
            pos = new Position(x, y);
            store = new Store();
            docking = new HashSet<Fleet>();
            name = _name;
        }

        ~Planet()
        {
        }

        public void NextTurn()
        {
            store.GenerateProduction();
        }

        public void Dock(Fleet f)
        {
            docking.Add(f);
        }

        public void Undock(Fleet f)
        {
            docking.Remove(f);
        }

        public bool InDock(Fleet f)
        {
            return docking.Contains(f);
        }

        public override string ToString()
        {

            return string.Format("Planeta: {0} position {1}.\n",Name,Pos)+store.ToString();
        }
    }
}
